//index.js
//获取应用实例
var app = getApp()

var modo = require('../modo/modo.js');


Page({
  data: {
    motto: 'Hello World',
    toMyPage:'this is my page!',
    userInfo: {},
    item:{
      yangyue:'123456lail',
      yangyue2:'yangyue5623'
    },
    artcleList:[],
    contentShow:true
  },
  showOne:function (item) {
    console.log(item)
    this.setData({
      contentShow:true
    })
  },
  showTwo:function (item) {
    console.log(item)
    
    this.setData({
      contentShow:false
    })
  },
  //事件处理函数
  bindViewTap: function() {
    wx.navigateTo({
      url: '../logs/logs'
    })
  },

  ToMyPage:function(){
    wx.navigateTo({
      url: '../search/search'
    })
  },
  requestFun:function(){
    var that = this;
    wx.request({
      url: 'https://www.linkloud.cn:8443/czly/sugarMedical/index',
      method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
      success: function(res){
        // success

        console.log(res.data)
        that.setData({
          artcleList: res.data.data
        })

      },
      fail: function(res) {
        // fail
      },
      complete: function(res) {
        // complete
      }
    })
  },
  modoIsFun:function(){
    modo.a(this.data.motto);
    console.log('my')
  },
  modoIsFunB:function(argument) {
    modo.b(this.data.motto);
    console.log('my')
  },
  onLoad: function () {
    console.log('onLoad')
    var that = this
    //调用应用实例的方法获取全局数据
    app.getUserInfo(function(userInfo){
      //更新数据
      that.setData({
        userInfo:userInfo
      })
    })
    
     wx.request({
      url: 'https://www.linkloud.cn:8443/czly/sugarMedical/index',
      method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
      success: function(res){
        // success

        console.log(res.data)
        that.setData({
          artcleList: res.data.data
        })

      },
      fail: function(res) {
        // fail
      },
      complete: function(res) {
        // complete
      }
    })


  },


})
